# Maintainer: Jelle van der Waa <jelle@archlinux.org>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>

_pkgname=html5-parser
pkgname=python-html5-parser
pkgver=0.4.11
pkgrel=1
pkgdesc="Fast C based HTML 5 parsing for python"
arch=('loong64' 'x86_64')
url="https://github.com/kovidgoyal/${_pkgname}"
license=('Apache')
depends=('python-chardet' 'python-lxml')
makedepends=('python-setuptools')
checkdepends=('python-beautifulsoup4')
optdepends=('python-beautifulsoup4: to use the soup treebuilder')
source=("https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/${_pkgname}/${_pkgname}-${pkgver}.tar.gz"{,.asc})
sha256sums=('85bb16faa3cdf3c6c6842e0cb2ce02807cbaefc6e3bb0f3b8e18dabe51070763'
            'SKIP')
b2sums=('a2c1037b5bf6dcb8e69f18b3404273993ee325f05a0c5e194ace3f68e0034fa1ac119bb3dde4c4f26dea62928b4dfda9ed1453760a5bb5f8faa9397fb0276a1a'
        'SKIP')
validpgpkeys=('3CE1780F78DD88DF45194FD706BC317B515ACE7C') # Kovid Goyal (New longer key) <kovid@kovidgoyal.net>

build() {
    cd "${srcdir}"/${_pkgname}-${pkgver}

    python setup.py build
}

check() {
    cd "${srcdir}"/${_pkgname}-${pkgver}

    python -m unittest discover -vs test
}

package() {
    cd "${srcdir}"/${_pkgname}-${pkgver}

    python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
}
